package com.kkb.dao;

import org.apache.commons.dbutils.QueryRunner;

import java.sql.Connection;
import java.sql.SQLException;

public class TransferDao {
    QueryRunner queryRunner = new QueryRunner();
    public void in(Connection connection, String inUser, Double money) throws SQLException {
        String sql = "update tb_account set money = money + ? where name = ?";
        Object[] params = {money, inUser};
        queryRunner.update(connection, sql, params);
    }

    public void out(Connection connection, String outUser, Double money) throws SQLException {
        String sql = "update tb_account set money = money - ? where name = ?";
        Object[] params = {money, outUser};
        queryRunner.update(connection, sql, params);
    }
}
